﻿<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="EasySL.UI.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:myControls="clr-namespace:EasySL.Controls;assembly=EasySL.Controls"
    xmlns:dataControl="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:dataForm="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit" 
    >
    <Grid x:Name="LayoutRoot" Margin="20">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        
        <StackPanel>
            <dataControl:DataGrid x:Name="dg" IsReadOnly="True" AutoGenerateColumns="False">
                <dataControl:DataGrid.Columns>
                    <dataControl:DataGridTextColumn Header="Number" IsReadOnly="True" Binding="{Binding Number}"/>
                    <dataControl:DataGridTextColumn Header="Name" IsReadOnly="True" Binding="{Binding Name}"/>
                </dataControl:DataGrid.Columns>
            </dataControl:DataGrid>

            <myControls:Pager x:Name="pager" PageSize="15" Margin="5"/>

            <myControls:Loading x:Name="loading" Margin="5"/>
        </StackPanel>

        <dataForm:DataForm x:Name="df" Grid.Column="1" VerticalAlignment="Top" Header="Products:" CurrentItem="{Binding SelectedItem, ElementName=dg, Mode=TwoWay}" AutoCommit="False" AutoEdit="False">
            <dataForm:DataForm.EditTemplate>
                <DataTemplate>
                    <StackPanel VerticalAlignment="Top">
                        <dataForm:DataField Label="Name">
                            <TextBox Text="{Binding Name, Mode=TwoWay, ValidatesOnExceptions=True}" />
                        </dataForm:DataField>
                    </StackPanel>
                </DataTemplate>
            </dataForm:DataForm.EditTemplate>

        </dataForm:DataForm>
    </Grid>
</UserControl>
